package com.rc.saas.mini.service.rc;

import com.rc.saas.mini.common.base.BaseMapper;
import com.rc.saas.mini.mapper.rc.RcEvaluateMapper;
import com.rc.saas.mini.model.rc.RcEvaluate;
import com.rc.saas.mini.model.rc.RcEvaluateExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RcEvaluateServiceImpl implements RcEvaluateService {
    @Autowired
    private RcEvaluateMapper rcEvaluateMapper;

    @Override
    public RcEvaluateMapper getMapper() {
        return rcEvaluateMapper;
    }

    public List<RcEvaluate> listByMemberId(Long memberId) {
        RcEvaluateExample rcEvaluateExample = new RcEvaluateExample();
        rcEvaluateExample.createCriteria().andMemberIdEqualTo(memberId);
        rcEvaluateExample.setOrderByClause("created_time desc");
        return rcEvaluateMapper.selectByExample(rcEvaluateExample);

    }
    @Override
    public Integer getavg(Long id) {
        return rcEvaluateMapper.getavg(id);
    }
}
